<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
	<head>
		<meta charset="utf-8">
		<title>上传考试基本信息</title>
		<script type="text/javascript">
			function toVaild(){
			    var val = document.getElementById("inputsubject").value;
				var val1 = document.getElementById("examend").value;
				var val2 = document.getElementById("examstart").value;
			    if(val != "" && val1 != "" && val2 != ""){
					var NowTime = new Date();
					var EndTime= new Date(val1);
					var StartTime= new Date(val2);
					var t1 =StartTime.getTime() - NowTime.getTime(); 
					var t2 =EndTime.getTime() - StartTime.getTime(); 
					if (t1<=100 || t2<=100){
						alert("请检查考试时间是否有误");
						return false;
					}
					else{
						return true;
					}  
			    }
			    else{
			        alert("考试基本信息填写不完全");
			        return false;
			    }
			}
		</script>
		<link href="css/app.css" rel="stylesheet">
		<link rel="stylesheet" href=""/>
		<link rel="stylesheet" href="../../static/css/exam/upexam.css"/>
	</head>
	<body>
		<div class="wrapper">
				<nav id="sidebar" class="sidebar js-sidebar">
					<div class="sidebar-content js-simplebar">
						<a class="sidebar-brand">
			      <span class="align-middle">考试系统</span>
			    </a>
			
						<ul class="sidebar-nav">
							<li class="sidebar-header">
										导航栏
									</li>
							
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="teacher.html" th:if="${usertype} eq '0'" >
							  <i class="align-middle" data-feather="user"></i> <span class="align-middle">个人主页</span>
							</a>
							<a class="sidebar-link" href="/personpage3" th:if="${usertype} eq '1'" >
							  <i class="align-middle" data-feather="user"></i> <span class="align-middle">个人主页</span>
							</a>
							<a class="sidebar-link" href="admin.html" th:if="${usertype} eq '2'" >
							  <i class="align-middle" data-feather="user"></i> <span class="align-middle">个人主页</span>
							</a>
									</li>
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="/myexam">
							  <i class="align-middle" data-feather="check-square"></i> <span class="align-middle">考试主页</span>
							</a>
									</li>
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="/class">
							  <i class="align-middle" data-feather="book"></i> <span class="align-middle">课程主页</span>
							</a>
									</li>
							
									<li class="sidebar-item">
										<a class="sidebar-link" href="/questionbankpage">
							  <i class="align-middle" data-feather="map"></i> <span class="align-middle">题库练习</span>
							</a>
									</li>
									<li class="sidebar-item" th:if="${usertype} eq '0'">
												<a class="sidebar-link" href="/AddExaminfo">
									  <i class="align-middle" data-feather="file"></i> <span class="align-middle">上传考试</span>
									</a>
											</li>
						</ul>
					</div>
				</nav>
			
				<div class="main">
					<nav class="navbar navbar-expand navbar-light navbar-bg">
						<a class="sidebar-toggle js-sidebar-toggle">
							<i class="hamburger align-self-center"></i>
						</a>
			
						<div class="navbar-collapse collapse">
							<ul class="navbar-nav navbar-align">
								<li class="nav-item dropdown">
									<a class="nav-icon dropdown-toggle d-inline-block d-sm-none" href="#" data-bs-toggle="dropdown">
										<i class="align-middle" data-feather="settings"></i>
									</a>
			
									<a class="nav-link dropdown-toggle d-none d-sm-inline-block" href="#" data-bs-toggle="dropdown">
										<i class="align-middle me-2" data-feather="feather"></i>
										<span th:if="${usertype} eq '0'">老师</span>
										<span th:if="${usertype} eq '1'">学生</span>
										<span th:if="${usertype} eq '2'">管理员</span>
										<img src="images/someicon/teacher.jpg" class="avatar img-fluid rounded me-1" alt="老师" th:if="${usertype} eq '0'"/> 
										<img src="images/someicon/student.jpg" class="avatar img-fluid rounded me-1" alt="学生" th:if="${usertype} eq '1'"/> 
										<img src="images/someicon/admin.jpg" class="avatar img-fluid rounded me-1" alt="管理员" th:if="${usertype} eq '2'"/> 
										<span class="text-dark" th:text="${usermail}"></span>
									</a>
									<div class="dropdown-menu dropdown-menu-end">
										<a class="dropdown-item" href="teacherinfoupdate" th:if="${usertype} eq '0'"><i class="align-middle me-1" data-feather="user"></i> 修改信息</a>
										<a class="dropdown-item" href="/newstudentInformation" th:if="${usertype} eq '1'"><i class="align-middle me-1" data-feather="user"></i>  修改信息</a>
										<a class="dropdown-item" href="admininfoupdate" th:if="${usertype} eq '2'"><i class="align-middle me-1" data-feather="user"></i>  修改信息</a>
										<div class="dropdown-divider"></div>
										<a class="dropdown-item" href="logout">Log out</a>
									</div>
								</li>
							</ul>
						</div>
					</nav>
		
				<!--在这里写我自己的东西-->
			
				<main class="content">
					<section class="mainbox">
							<div class="column">
								<h3>考试基本信息</h3>
								<div class="card">
									<div class="card-body">
										<div class="divide">
											<div class="subdivide">
												<label for="inputsubject" class="form-label">考试科目</label>
												<input class="form-control" type="text" name="subject" placeholder="科目-必填项" id="inputsubject" form="form1">
											</div>
										</div>
										<div class="divide">
											<div class="subdivide">
												<label for="examstart" class="form-label">考试开始时间</label>
												<input class="form-control" type="datetime-local" name="starttime"  id="examstart"
												onpropertychange="checkinput();" form="form1">
											</div>
											<div class="subdivide">
												<label for="examend" class="form-label">考试结束时间</label>
												<input class="form-control" type="datetime-local" name="endtime"  id="examend" form="form1">
											</div>
										</div>
										<div class="divide">
											<div class="subdivide">
												<label for="class1" class="form-label">考试班级</label>
												<div th:if="${#lists.isEmpty(teacherclasses)}">
													<div class="classtable">
														<div class="fornothave"></div>
														<div class="fornothave">
															<div class="subsub"></div>
															<div class="subsub">
																没有班级？
																<form action="/class" enctype='multipart/form-data' method='POST'>
																	<button type="submit" style="width: 80px; height: 40px; border-radius: 20%;border: none;background-color: #17A2B8;">
																		<h4 style="margin-top:8px;">
																			<font color="white">创建班级</font>
																		</h4>
																	</button>
																</form>
															</div>
															<div class="subsub"></div>
														</div>
														<div class="fornothave"></div>
													</div>
												</div>
												<div th:if="${not #lists.isEmpty(teacherclasses)}">
													<div class="classtable">
														<div class="eachclass">
															<div class="subclassid">
																
															</div>
															<div class=subclassname>
																<span> 班级名称 </span>
															</div>
															<div class=subclasstype>
																<span style='padding-left: 30px;padding-right: 30px'> 班级科目 </span>
															</div>
															<div class=subclassinfo>
																<span style='padding-left: 60px;padding-right: 60px'> 班级简介 </span>
															</div>
															<div class=submoreinfo>
																<span> 更多信息 </span>
															</div>
														</div>
														<div th:each="i:${teacherclasses}">
															<div class="eachclass">
																<div class="subclassid">
																	<input type="checkbox" name="classid" th:value="${i.classid}" class="form-check-input" form="form1">
																</div>
																<div class=subclassname>
																	<span th:text="${i.classname}"></span>
																</div>
																<div class=subclasstype>
																	<span th:text="${i.classtype}"></span>
																</div>
																<div class=subclassinfo>
																	<span th:text="${i.information}"></span>
																</div>
																<div class=submoreinfo>
																	<form action="/checkclass" enctype='multipart/form-data' method='POST'>
																		<input type="hidden" name="classid" th:value="${i.classid}" >
																		<button type="submit" style="height:18px;width:40px;
																		margin-left:10px;border-radius: 5px;background-color: #85b7ec;">
																			<p style="font-size: 5px;">详情</p>
																		</button>
																	</form>
																</div>
															</div>
														</div>		
													</div>
												</div>
											</div>
										</div>
										<div class="divide1">
											<div class="subdivide">
												<div class="forradio">
													<div class="subdivide">
														<input  class="form-check-input" type="radio" name="type" value=0 form="form1">
														<span class="form-check-label">贡献为题库</span>
													</div>
													<div class="subdivide">
														<input class="form-check-input" type="radio" name="type" value=1 form="form1">
														<span class="form-check-label">不贡献为题库</span>
													</div>
												</div>	
											</div>
											<div class="subdivide">
												<form class="form-horizontal" onsubmit="return toVaild()" action="/AddExaminfo1" enctype='multipart/form-data' method='POST' id="form1">
													<button type="submit" style="height:30px;width:100px;margin-top:10px;
														margin-left:230px;border-radius: 10px;background-color: #5e80a6;">
														提交考试
													</button>
												</form>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="column">
								
							</div>
					</section>
				</main>
				
				
			</div>
		</div>
		
		<script src="js/app.js"></script>
	</body>
</html>
